﻿Imports System.Data.SqlClient
Imports Microsoft.Practices.EnterpriseLibrary.Data

Partial Public Class RestauraContraseña
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnRestaurar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnRestaurar.Click
        Dim numero As Integer
        Dim dpSQL As DataView = DirectCast(SQLPERSONAL.Select(DataSourceSelectArguments.Empty), DataView)
        Dim deSQL As DataView = DirectCast(SQLESTUDIANTE.Select(DataSourceSelectArguments.Empty), DataView)

        If dpSQL.Count > 0 Then
            numero = 1
            Session("id") = dpSQL(0).Item(0)
            Session("correo") = dpSQL(0).Item(1)
            Session("clave") = dpSQL(0).Item(2)
        ElseIf deSQL.Count > 0 Then
            numero = 2
            Session("id") = deSQL(0).Item(0)
            Session("correo") = deSQL(0).Item(1)
            Session("clave") = deSQL(0).Item(2)
        Else
            lblmensaje.ForeColor = Drawing.Color.Red
            lblmensaje.Text = "NO EXISTE SESSION"
        End If

        If numero = 1 Then
            Dim stSQL As DataView = DirectCast(Stored.Select(DataSourceSelectArguments.Empty), DataView)

        End If

        If numero = 2 Then
            Response.Redirect("/04ALUMNO/inicio-alumn.aspx")
        End If

        Dim Conn As New SqlConnection("Data Source=EMANUEL-HP; Initial Catalog=ASI2UFG; Persist Security Info=True; User ID=sa; Password=1234")
        Dim cmd As New SqlCommand
        Dim reader As SqlDataReader

        cmd.CommandText = "SELECT * FROM Customers"
        cmd.CommandType = CommandType.Text
        cmd.Connection = Conn

        Conn.Open()

        reader = cmd.ExecuteReader()
        ' Data is accessible through the DataReader object here.

        Conn.Close()
    End Sub
End Class